//
//  TGCDataCenter.h
//  TGC
//
//

#import <Foundation/Foundation.h>
//#import "CHKeychain.h"

static NSString * const g_strKey_UserInfo           = @"userInfo";

static NSString * const g_strKey_SearchedHistory    = @"searchedHistory";


@class TGCDataCenter;
@protocol CVAppDataCenterDelegate <NSObject>

@optional


@end

@interface TGCDataCenter : NSObject{

    NSMutableDictionary  *_userDict;
    NSMutableArray *_usedaddressarr;

}

@property (nonatomic,assign,readonly)BOOL isLogin;
@property (nonatomic,strong,readonly)NSMutableDictionary  *userDict;


+(TGCDataCenter *)defaultCenter;

+(CGSize)getContentSize:(NSString *)content
            WithMaxSize:(CGSize)maxSize
                   Font:(UIFont *)font
          LineBreakMode:(NSLineBreakMode)lineBreakMode;


-(void)loginWithUserDict:(NSDictionary *)dict;
-(void)reloadUserDict:(NSDictionary *)dict;
-(void)logout;

#pragma mark - 保存用户信息
-(void)saveUserName:(NSString *)username
           password:(NSString *)password
          authority:(NSString *)authority
              isMan:(NSString *)isMan
           telphone:(NSString *)telphone
        displayname:(NSString *)displayname
           usertype:(NSString *)usertype
             userid:(NSString *)userid
          positinal:(NSString *)positinal;




#pragma mark - 保存配置信息
-(void)savebookidarr:(NSArray *)bookidarr
           lixingarr:(NSArray *)lixingarr
            wenduarr:(NSArray *)wenduarr
             timearr:(NSArray *)timearr
            speedarr:(NSArray *)speedarr
             bxareaarr:(NSArray *)bxareaarr
             ydareaarr:(NSArray *)ydareaarr;

#pragma mark - 保存网络开关信息
-(void)saveneedwifi:(NSString *)isneed;
#pragma mark - 读取用户信息
-(NSDictionary *)readUserInfo;
#pragma mark - 清除用户信息
-(void)clearUserInfo;

-(void)saveSearchHistory:(NSString *)searchKey;
-(NSMutableArray *)getSearchHistory;
-(void)clearSearchHistory;

#pragma mark - 判断当前网络
-(void)getnownetworktype;
-(NSString *)getnowtime;
-(NSMutableArray *)getusedaddressarr:(NSString *)nowmaddress;
+(NSString *)getDateStringByDate:(NSDate *)date
               withDateFormatter:(NSString *)formatterString;
//根据毫秒转换成日期时间
+(NSString *)getDateStringBySecondStr:(NSString *)secondStr
                    withDateFormatter:(NSString *)formatterString;
//根据日期时间转换成毫秒字符串
+(NSString *)getSecondStringByDateStr:(NSString *)dateStr;

-(void)addusedaddressArray:(NSObject *)object;

-(void)removeusedaddressArray:(NSObject *)object;
-(NSMutableArray *)getusedaddressArray;

@end
